import java.lang.Thread;
import java.awt.FlowLayout;
import javax.swing.JComponent;
import javax.swing.JFrame;
import javax.swing.JMenu;
import javax.swing.JMenuBar;
import javax.swing.JMenuItem;
import javax.swing.JScrollPane;
import javax.swing.JSplitPane;
import javax.swing.JTabbedPane;
import javax.swing.SwingUtilities;

import edu.wpi.cetask.guide.Guide;


/**
* This code was edited or generated using CloudGarden's Jigloo
* SWT/Swing GUI Builder, which is free for non-commercial
* use. If Jigloo is being used commercially (ie, by a corporation,
* company or business for any purpose whatever) then you
* should purchase a license for each developer using Jigloo.
* Please visit www.cloudgarden.com for details.
* Use of Jigloo implies acceptance of these licensing terms.
* A COMMERCIAL LICENSE HAS NOT BEEN PURCHASED FOR
* THIS MACHINE, SO JIGLOO OR THIS CODE CANNOT BE USED
* LEGALLY FOR ANY CORPORATE OR COMMERCIAL PURPOSE.
*/
public class eBayJApplet extends javax.swing.JApplet {
	/**
	 * 
	 */
	private static final long serialVersionUID = -2070668928189880765L;
	private JSplitPane jSplitPaneBrowser;
	private JScrollPane jScrollPane1;
	private JMenuItem jMenuItem1;
	private JTabbedPane jTabbedPaneNavigation;
	private JMenuItem jMenuItem3;
	private JMenuItem jMenuItem2;
	private JMenu jMenu2;
	private JMenu jMenu1;
	private JMenuBar jMenuBar1;

	private Browser browser;
	//private Console console;
	
	private guideThread theGuideThread;

	{
		//Set Look & Feel
		try {
			javax.swing.UIManager.setLookAndFeel("com.sun.java.swing.plaf.windows.WindowsClassicLookAndFeel");
		} catch(Exception e) {
			e.printStackTrace();
		}
	}

	/**
	* Auto-generated main method to display this 
	* JApplet inside a new JFrame.
	*/
	public static void main(String[] args) {
		SwingUtilities.invokeLater(new Runnable() {
			public void run() {
				JFrame frame = new JFrame("EZ Listing Page");
				eBayJApplet inst = new eBayJApplet();
				frame.getContentPane().add(inst);
				((JComponent)frame.getContentPane()).setPreferredSize(inst.getSize());
				frame.pack();
				frame.setVisible(true);
			}
		});

	}
	
	public eBayJApplet() {
		super();
		initGUI();
		initBrowser();
		initGuide();
		initTasks();
	}
	
	private void initGUI() {
		try {
			FlowLayout thisLayout = new FlowLayout();
			getContentPane().setLayout(thisLayout);
			this.setSize(800, 600);
			{
				jTabbedPaneNavigation = new JTabbedPane();
				getContentPane().add(jTabbedPaneNavigation);
				jTabbedPaneNavigation.setPreferredSize(new java.awt.Dimension(800, 600));
				{
					//console = new Console();
					jTabbedPaneNavigation.addTab("Console", null, null, null);
				}
				{
					jSplitPaneBrowser = new JSplitPane();
					jTabbedPaneNavigation.addTab("Tasks", null, jSplitPaneBrowser, null);
					jSplitPaneBrowser.setPreferredSize(new java.awt.Dimension(439, 230));
					{
						jScrollPane1 = new JScrollPane();
						jSplitPaneBrowser.add(jScrollPane1, JSplitPane.LEFT);
						jScrollPane1.setPreferredSize(new java.awt.Dimension(300, 600));
					}
				}
				{
					browser = new Browser();
					jTabbedPaneNavigation.addTab("Browser", null, browser, null);
				}
				{
					jTabbedPaneNavigation.addTab("HTML", null, null, null);
				}
			}
			{
				jMenuBar1 = new JMenuBar();
				setJMenuBar(jMenuBar1);
				{
					jMenu1 = new JMenu();
					jMenuBar1.add(jMenu1);
					jMenu1.setText("File");
					{
						jMenuItem1 = new JMenuItem();
						jMenu1.add(jMenuItem1);
						jMenuItem1.setText("Open");
					}
					{
						jMenuItem2 = new JMenuItem();
						jMenu1.add(jMenuItem2);
						jMenuItem2.setText("Save");
					}
					{
						jMenuItem3 = new JMenuItem();
						jMenu1.add(jMenuItem3);
						jMenuItem3.setText("Save As");
					}
				}
				{
					jMenu2 = new JMenu();
					jMenuBar1.add(jMenu2);
					jMenu2.setText("Edit");
				}
			}
		} catch (Exception e) {
			e.printStackTrace();
		}
	}

	private void initBrowser() {
		browser.loadURL("file:///F:/Michal's%20Documents/Eclipse%20Workspace/EZ%20Listing%20Page/src/template.html");
	}

	private void initGuide() {
		String uri = "F:\\Michal's Documents\\Eclipse Workspace\\CE Task Engine\\models\\eBay.xml";
		String topTask = "CreateListingPage";

		theGuideThread = new guideThread();
		theGuideThread.start();
		//theGuideThread.guide.load(uri);
		//theGuideThread.guide.task(topTask);
	}
	
	private class guideThread extends Thread {
		public Guide guide;
		
        public void run() {
    		String[] args = new String[0];
    		//String[] args = {"-speech"};
    		//String[] args = {"F:\\Michal's Documents\\Eclipse Workspace\\CE Task Engine\\test\\eBay1"};
    		
    		//guide.main(args);
        }
	}

	private void initTasks() {
		//guide.status("ignore");
	}
}
